<template>
  <div class="subView3">子页面3
    <div>{{getterCollector("value1")}}</div>
  </div>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
export default {
  name: "subView3",
  data() {
    return {};
  },
  computed: {
    ...mapGetters("testStore", ["getterCollector"]),
  },
  created() {
    // this.testFileUpload();
    this.testSetState();
  },
  mounted() {},
  activated() {},
  deactivated() {},
  methods: {
    ...mapMutations("testStore", ["setterCollector"]),

    testFileUpload() {
      this.$network
        .netRequest({
          method: "FILE",
          IPPort: "fileUpload",
          urlName: "testFileUpload",
          fileObj: {},
        })
        .then((res) => {})
        .catch((err) => {});
    },

    testSetState() {
      this.setterCollector({
        valueName: "value1",
        valueVal: "view3 test set value1",
        fn: (obj) => {
          this.$utils.setConsole("set操作同步回调-正常-：", obj);
        },
      });

      setTimeout(() => {
        this.setterCollector({
          valueName: "value1",
          valueVal: "view3 test set value1 2s",
          fn: (obj) => {
            this.$utils.setConsole("set操作同步回调-正常-：", obj);
          },
        });
      }, 1000);

      this.setterCollector({
        valueName: "view3TestSetErr",
        valueVal: "view3 test set value1",
        fn: (obj) => {
          this.$utils.setConsole("set操作同步回调-异常-：", obj);
        },
      });
    },
  },
};
</script>
<style scoped>
.subView3 {
  background: #80fdb0;

  height: 100%;
  /* stretch 属性标识按照对称轴垂直方向沾满容器 前提是容器没有设置对称轴垂直方向的距离属性 width/height*/
  align-self: stretch;
  padding: 10px;
  margin: 2px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}
</style>